<script type="text/javascript">
	
function timeout(val, ms) {
  return new Promise((resolve) => {
    setTimeout(()=>resolve(val), ms);
  });
}

async function asyncPrint(value, ms) {
  let a = await timeout(1, ms);
  value += a;
  console.log(value);
}

asyncPrint(2, 2000);

</script>